package com.zmn.plat.common.dictionary;

/**
 * 描述: 渠道服务商二级类型
 *
 * @author jiafei
 * @version v1.0
 * @since 2021/6/9 18:26
 */
public enum ChannelSpTwoTypeEnum {

    /**
     * 描述: 直营
     */
    DIRECTLY(10, "直营"),
    /**
     * 描述: 非直营
     */
    NON_DIRECT(20, "非直营"),
    ;

    private Integer code;
    private String name;

    ChannelSpTwoTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 描述:
     *
     * @param code code
     * @return com.zmn.plat.common.dictionary.ChannelSpTwoTypeEnum
     * @author jiafei
     * @since 2021/6/9 18:37
     */
    public static ChannelSpTwoTypeEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 10:
                return DIRECTLY;
            case 20:
                return NON_DIRECT;
            default:
                return null;
        }
    }


    public static String getName(Integer code) {
        ChannelSpTwoTypeEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
